package net.xinqushi.pthread.pthread.lock;

import com.sun.corba.se.impl.orbutil.concurrent.ReentrantMutex;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author xjie 2019/8/13 14:21
 * @description Java锁
 * @see java.util.concurrent.locks.ReentrantLock  互斥锁/可重入锁/公平锁/非公平锁（两种模式，公平、非公平）
 * @see java.util.concurrent.locks.ReadWriteLock  共享锁(2种模式，读写)
 * @see ReentrantMutex 可重入/互斥锁
 * @see com.sun.corba.se.impl.orbutil.concurrent.Mutex  不可重入/互斥锁
 * @see java.util.concurrent.locks.AbstractQueuedSynchronizer  Java锁的基类
 * @see java.util.concurrent.CountDownLatch  AQS的一个常用的concrete实现
 */
public class LockTest {

    public static void main(String[] args) {
        Lock reentrantMutexLock = new ReentrantLock();
        reentrantMutexLock.lock();
        try {
            System.out.println("get the reentrant mutex lock");
        }finally {
            reentrantMutexLock.unlock();
        }
    }
}
